define(function(require,exports,module){

	exports.init = function(){

	}	
	exports.operate = function(){
		mouseleave_email_input();
		//after click pwd find
		after_click_pwd_find();
	}
	exports.win_resize = function(){

	}
	function after_click_pwd_find(){
		$(".pwd_find").live('click',function(){
			var pwd_find_email = $('input[name="pwd_find_email"]').val();
			var email_reg = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
			if(!email_reg.test(pwd_find_email)){
				$('input[name="pwd_find_email"]').css("border",'1px solid red');
				$('input[name="pwd_find_email"]').css("color",'red');
				return ;				
			}else{
				$('input[name="pwd_find_email"]').css("border",'1px solid green');
				$('input[name="pwd_find_email"]').css("color",'green');				
			}
			$.post(pwd_find_var.afterClickPwdFindUrl,{email:pwd_find_email},function(e){
				if(!e.status){
					$.Zebra_Dialog(e.message, {
					    'type':'error',
					    'title':'错误',
					    'buttons':  ['确定'],
					    'onClose':  function() {
					    }
					});	
				}else{
					$.Zebra_Dialog(e.message, {
					    'type':'information',
					    'title':'成功',
					    'buttons':  ['确定'],
					    'onClose':  function() {
					    }
					});	
					$(".userpwdfind_email_div").html("请查收邮件并进行密码重置！");
				}
			},'json');
		})
	}

	function mouseleave_email_input(){
		$("input[name='pwd_find_email']").live('input',function(){
			var pwd_find_email = $('input[name="pwd_find_email"]').val();
			var email_reg = /\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/;
			if(!email_reg.test(pwd_find_email)){
				$('input[name="pwd_find_email"]').css("border",'1px solid red');
				$('input[name="pwd_find_email"]').css("color",'red');
				return ;				
			}else{
				$('input[name="pwd_find_email"]').css("border",'1px solid green');
				$('input[name="pwd_find_email"]').css("color",'green');				
			}			
		})
	}
});